SharePoint modern list view customization example 您所在的位置:网站首页 best status page examples advanced customization SharePoint modern list view customization example

SharePoint modern list view customization example

2023-04-07 19:55| 来源: 网络整理| 查看: 265

In this SharePoint customization tutorial, we will discuss how to customize the SharePoint modern list view using JSON. Here we will see various sharepoint modern list view customization examples.

Apart from this, we will also see a few sharepoint column formatting examples, and sharepoint column formatting json examples.

As we know in the year 2016, SharePoint online team released Modern List and Library experience in both SharePoint On-Premise and online. So now a day business recommends this feature for more benefits.

I am not using JSLink to customize our modern list rather than, I am going forward to use JSON for an excellent user interface.

If we go in detail, there are many good features added in both modern lists and libraries but here I am using those called List View Customizations.

Table of Contents

SharePoint modern list view customization example

Here, I have taken a laptop list and we will see how by using the SharePoint Online list view customization using JSON, we can change the list view.

Step 1: I have created a SharePoint Online List called Laptop List and it contains the following column name.

Title – Single Line TextModel- Single Line Text.Processor– Single Line TextRAM: Single Line TextHard Disk: Single Line TextScreen Size: Singe Line TextBattery : Single Line TextRating : NumberPhoto: Hyperlink sharepoint list view customizationSharePoint modern list view customization example

Step 2: Next click on All Items and click on Format View to implement our customization code.

sharepoint online modern list view

Step 3: Next copy the below code and paste it inside code editor and click on Save.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "hideSelection": true, "hideColumnHeader": true, "rowFormatter": { "elmType": "div", "_comment_": "Laptop Photo DIV", "attributes": { "class": "ms-bgColor-greenLight" }, "style": { "display": "flex", "flex-wrap": "wrap", "align-items": "stretch", "flex-direction": "row", "padding": "20px", "margin-bottom": "16px", "max-width": "850px", "border-radius": "8px" }, "children": [ { "elmType": "div", "__comment": "DIV L1", "style": { "flex-grow": "1", "display": "flex", "flex-direction": "column", "flex-wrap": "nowrap", "align-items": "stretch", "max-width": "260px" }, "children": [ { "elmType": "img", "style": { "width": "260px", "height": "160px" }, "attributes": { "src": "[$Photo]" } } ] }, { "elmType": "div", "__comment": "DIV L2", "style": { "flex-grow": "1", "display": "flex", "flex-direction": "column", "flex-wrap": "nowrap", "align-items": "center", "max-width": "360px", "min-width": "205px" }, "children": [ { "elmType": "span", "txtContent":"='Brand : ' + [$Title]", "style": { "display": "block" }, "attributes": { "class": "ms-fontSize-l ms-fontWeight-semibold ms-fontColor-neutralPrimary" } }, { "elmType": "span", "txtContent": "Model", "style": { "display": "block", "padding-top": "20px" }, "attributes": { "class": "ms-fontSize-l ms-fontWeight-semibold ms-fontColor-neutralPrimary" } }, { "elmType": "span", "txtContent": "[$Model]" }, { "elmType": "span", "txtContent": "='Processor : ' + [$Processor]", "style": { "display": "block", "padding-top": "20px" }, "attributes": { "class": "ms-fontSize-l ms-fontWeight-semibold ms-fontColor-neutralPrimary" } } ] }, { "elmType": "div", "__comment": "DIV L3", "style": { "flex-grow": "1", "display": "flex", "flex-direction": "column", "align-items": "center", "margin-top": "10px", "max-width": "310px", "min-width": "155px" }, "children": [ { "elmType": "div", "__comment": "HardWwareDIV", "style": { "display": "block", "font-size": "15px", "font-weight": "bold" }, "children": [ { "elmType": "span", "txtContent": "[$RAM]", "style": { "padding-right": "5px" } } ] }, { "elmType": "span", "txtContent": "Price", "style": { "display": "block", "padding-top": "20px" }, "attributes": { "class": "ms-fontSize-l ms-fontWeight-semibold ms-fontColor-neutralPrimary" } }, { "elmType": "span", "txtContent": "=[$Price]", "style": { "display": "block" } }, { "elmType": "span", "txtContent": "Rating", "style": { "display": "block", "padding-top": "20px" }, "attributes": { "class": "ms-fontSize-l ms-fontWeight-semibold ms-fontColor-neutralPrimary" } }, { "elmType": "span", "txtContent": "=[$Rating]", "style": { "padding-right": "5px" } }, { "elmType": "span", "attributes": { "iconName": "FavoriteStarFill", "class": "ms-fontColor-themePrimary" } } ] } ] } }

Step 4: Once I click on the Save button, the SharePoint List view got changed to different views which same as the below screenshot.

sharepoint modern list view customizationSharePoint modern list view customization example

This is all about customization of List View in SharePoint Modern List.

Create a birthday view using SharePoint Online modern list view customization

Let us see, how to create a birthday view using SharePoint Online modern list view customization using JSON.

Follow the below steps to create a sharepoint birthday list view using SharePoint modern list view customization with JSON.

Step 1: I have created a SharePoint List called Birthday List and it contains the following column name.

Title – Single Line TextCompany – Single Line TextE-Mail – Single Line TextDepartment – Single Line TextDesignation – Single Line TextPhoto – photoBirthday – DateDOM – Single Line Text create a birthday view using SharePoint Online modern list view customizationsharepoint birthday list

Step 2: Next click on All Items and click on Format View to implement our customization code.

create a birthday view sharepoint onlinesharepoint modern list view styles

Step 3: Next copy the below code and paste it inside code editor and click on Save.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "hideSelection": true, "hideListHeader": true, "rowFormatter": { "elmType": "div", "style": { "display": "flex", "flex-wrap": "wrap", "align-items": "stretch", "padding": "8px", "margin-bottom": "25px", "max-width": "420px", "border-radius": "8px", "box-shadow": "4px 4px 8px lightblue" }, "attributes": { "class": "ms-bgColor-themePrimary ms-fontColor-white" }, "children": [ { "elmType": "div", "style": { "flex-grow": "1", "display": "flex", "flex-wrap": "wrap", "align-items": "stretch", "max-width": "310px" }, "children": [ { "elmType": "div", "style": { "flex": "none" }, "children": [ { "elmType": "div", "style": { "height": "100px", "overflow": "hidden", "border-radius": "5%", "margin-right": "8px" }, "children": [ { "elmType": "span", "txtContent": "[$Title]", "style": { "display": "block" }, "attributes": { "class": "ms-fontSize-l ms-fontWeight-semibold ms-fontColor-white" } }, { "elmType": "span", "txtContent": "[$Company]", "style": { "display": "=if([$Company] == '', 'none', 'block')" }, "attributes": { "class": "ms-fontSize-m ms-fontWeight-regular ms-fontColor-white" } }, { "elmType": "span", "txtContent": "[$Department]", "style": { "display": "=if([$Department] == '', 'none', 'block')" }, "attributes": { "class": "ms-fontSize-m ms-fontWeight-regular ms-fontColor-white" } }, { "elmType": "span", "txtContent": "[$Designation]", "style": { "display": "=if([$Designation] == '', 'none', 'block')" }, "attributes": { "class": "ms-fontSize-m ms-fontWeight-regular ms-fontColor-white" } } ] } ] } ] }, { "elmType": "div", "style": { "display": "flex", "flex-direction": "column", "max-width": "310px", "min-width": "95px" }, "children": [ { "elmType": "div", "style": { "flex-grow": "1" }, "children": [ { "elmType": "span", "style": { "display": "=if([$Birthday]


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有